.NET Block interface overview

The IBlock Interface

The IBlock Interface is required by the .NET Wrapper Block. This interface is used when your object takes input fields and generates output fields. All four interfaces use almost the same methods, they just differ in parameters. These methods can be broken up into the following categories:

  • Configuration: The GetConfigurationControl and Configure methods are used when the .NET Wrapper Block is being configured. This is done during the visual configuration of your object.

    • GetConfigurationControl: This method is called to get the user control for your object to be shown in the .NET Wrapper Block configuration dialog. If your object does not have a configuration control, simply return null (in C#), nothing (in VB.NET) or nullptr. (in C++/CLI).

    • Configure: This method is called when the user applies the changes. In this method your object will receive the configured user control and can then extract all the required information. If your object did not return a configuration control, then this method will do nothing.

  • Output field creation: When the .NET Wrapper Block configuration dialog is closed, the UpdateOutputFields method will be called. This will allow your object to create all the output fields it will generate. This method is not on the ISinkBlock interface because sinks do not create output fields.

  • Runnability: When the user checks to see if their blueprint is runnable, the CheckRunnability method will be called. In this method you will receive the IRunnabilityResult interface on which you can report any errors or warnings.

  • Execution: When the block is used in execution, the ExecutionStarted, Execute and ExecutionStopped methods will be called.

    • ExecutionStarted: This is the first call on your object to notify it that your object is going to be executed. In this method you will usually setup all run-time properties.

    • Execute: This method is called every time the object must execute because the input values may have changed and it must calculate new output values.

    • ExecutionStopped: This method is called when the blueprint stops. This method is usually used for cleanup.

The .NET Wrapper Source Blocks add an additional 3 read-only properties that will be used during execution. They are:

  • FirstExecuteTime: This property gives the first execute time on which your source must be executed.

  • IsAtEnd: Is your object at the end of its data.

  • NextExecuteTime: This property is called after every execute of your object to get the next execute time for our source object.

NOTE: There are no persistence methods to load and save your object. This is handled through the .NET serialization. See the Persistence section for more information.

The interface is defined as:

public interface IBlock

{

    UserControl GetConfigurationControl(InputFields inputFields);

    void Configure(InputFields inputFields, UserControl control);

    void UpdateOutputFields(InputFields inputFields, OutputFields outputFields);

    void CheckRunnability(InputFields inputFields, IRunnabilityResult result);

    void ExecutionStarted();

    void Execute(DateTime executeTime, InputValues inputs, OutputValues outputs);

    void ExecutionStopped();

}

Persistence

All classes must be marked with the Serializable attribute otherwise the object will not be persisted correctly. Also remember to mark all internal structs and classes with Serializable attribute if they need to be persisted. Mark all variables that are not required for persistence with the Non-Serialized attribute.


Related topics:

  

CSense 2023- Last updated: June 24,2025